<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>uCXpresso.BLE: /ble/ble_proximity/src/main.cpp</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../upnp.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">uCXpresso.BLE
   &#160;<span id="projectnumber">v1.0.4</span>
   </div>
   <div id="projectbrief">RTOS C++ Framework for Bluetooth Low Energy</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li><a href="../../examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d7/d19/_2ble_2ble_proximity_2src_2main_8cpp-example.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">/ble/ble_proximity/src/main.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>This is an example of how to use the <a class="el" href="../../de/d67/classble_proximity.html">bleProximity</a> class. More details about this example.</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> ===============================================================================</span></div>
<div class="line"><span class="comment"> Name        : main.c</span></div>
<div class="line"><span class="comment"> Author      : Jason</span></div>
<div class="line"><span class="comment"> Version     : v1.0.3</span></div>
<div class="line"><span class="comment"> Date        : 2014/3/10</span></div>
<div class="line"><span class="comment"> Copyright   :</span></div>
<div class="line"><span class="comment"> Description : proximity service for BLE</span></div>
<div class="line"><span class="comment"> ===============================================================================</span></div>
<div class="line"><span class="comment">                                 History</span></div>
<div class="line"><span class="comment"> ---------+---------+--------------------------------------------+-------------</span></div>
<div class="line"><span class="comment"> DATE     | VERSION |   DESCRIPTIONS                             |  By</span></div>
<div class="line"><span class="comment"> ---------+---------+--------------------------------------------+-------------</span></div>
<div class="line"><span class="comment"> 2014/1/20 v1.0.0   First Edition                                   Jason</span></div>
<div class="line"><span class="comment"> 2014/2/20 v1.0.1   Add tone                                        Jason</span></div>
<div class="line"><span class="comment"> 2014/2/28 v1.0.2   Add Device Information Service                  Jason</span></div>
<div class="line"><span class="comment"> 2014/3/10 v1.0.3   Rename onLinkLose to onLinkLoss.                Jason</span></div>
<div class="line"><span class="comment"> ===============================================================================</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &quot;uCXpresso.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/serial.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/usb_cdc.h&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#include &quot;debug.h&quot;</span></div>
<div class="line"><span class="preprocessor">#define DBG     dbg_printf</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define DBG(...)</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// TODO: insert other include files here</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/timeout.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_serial.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_proximity.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_battery.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_ht.h&quot;</span>       <span class="comment">// health thermometer service</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_devinfo.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/power.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;arduino/tone.h&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// TODO: insert other definitions and declarations here</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// Alert definitions</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="preprocessor">#define ALERT_FREQ      3800    // alarm 3800Hz</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define ALERT_PIN       P19     // p19 can driver a 40mA for buzzer</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><a name="_a0"></a><a class="code" href="../../d7/db9/class_c_pin.html">CPin</a> ledPower(<a name="a1"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fadac6477842247cab1a8c02c65f431b44">LED1</a>);</div>
<div class="line"><a class="code" href="../../d7/db9/class_c_pin.html">CPin</a> ledAlertH(<a name="a2"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fa8379bbaa96d151e6adac488b2a147b7a">LED2</a>);</div>
<div class="line"><a class="code" href="../../d7/db9/class_c_pin.html">CPin</a> ledAlertL(<a name="a3"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fa5dec293e081e0fc78369c842fab8452b">LED3</a>);</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// power Save Class</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">class </span>myPowerSave: <span class="keyword">public</span> <a name="_a4"></a><a class="code" href="../../d5/d3e/class_c_power_save.html">CPowerSave</a> {</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">void</span> onSleep(uint32_t ulExpectedIdleTime) {</div>
<div class="line">        ledPower = <a name="a5"></a><a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80afc0ca8cc6cbe215fd3f1ae6d40255b40">LED_OFF</a>;</div>
<div class="line">        CPowerSave::onSleep(ulExpectedIdleTime);</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">void</span> onWakeup(uint32_t *pExpectedIdleTime) {</div>
<div class="line">        CPowerSave::onWakeup(pExpectedIdleTime);</div>
<div class="line">        ledPower = <a name="a6"></a><a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80add01b80eb93658fb4cf7eb9aceb89a1d">LED_ON</a>;</div>
<div class="line">    }</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// myProximity Class</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">class </span>myProximity : <span class="keyword">public</span> <a name="_a7"></a><a class="code" href="../../de/d67/classble_proximity.html">bleProximity</a> {</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    myProximity(<a name="_a8"></a><a class="code" href="../../d7/d03/classble_serial.html">bleSerial</a> &amp;ble) : <a class="code" href="../../de/d67/classble_proximity.html">bleProximity</a>(ble) {</div>
<div class="line">        <span class="comment">// nothing</span></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a name="a9"></a><a class="code" href="../../de/d67/classble_proximity.html#a43c9187ddcb7237099ff414b74c5b0bd">onAlert</a>(uint8_t level) {</div>
<div class="line">        DBG(<span class="stringliteral">&quot;On Alert: %d\n&quot;</span>, level);</div>
<div class="line">        <span class="keywordflow">switch</span>(level) {</div>
<div class="line">        <span class="keywordflow">case</span> 0:</div>
<div class="line">            ledAlertH = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80afc0ca8cc6cbe215fd3f1ae6d40255b40">LED_OFF</a>;</div>
<div class="line">            ledAlertL = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80afc0ca8cc6cbe215fd3f1ae6d40255b40">LED_OFF</a>;</div>
<div class="line">            <span class="keywordflow">break</span>;</div>
<div class="line">        <span class="keywordflow">case</span> 1:</div>
<div class="line">            ledAlertL = !ledAlertL;</div>
<div class="line">            <span class="keywordflow">break</span>;</div>
<div class="line">        <span class="keywordflow">case</span> 2:</div>
<div class="line">            ledAlertH = !ledAlertH;</div>
<div class="line">            tone(ALERT_PIN, ALERT_FREQ, 150, 3);    <span class="comment">//  duration=150ms, count=3 times</span></div>
<div class="line">            <span class="keywordflow">break</span>;</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a name="a10"></a><a class="code" href="../../de/d67/classble_proximity.html#a193eb5410fc4cf4b35613ad931ae61ff">onLinkLoss</a>(uint8_t level) {</div>
<div class="line">        DBG(<span class="stringliteral">&quot;On Link Lose: %d\n&quot;</span>, level);</div>
<div class="line">    }</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// main task</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">void</span>) {</div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">    #if __USE_USB</span></div>
<div class="line"><span class="preprocessor"></span>        <a name="_a11"></a><a class="code" href="../../d6/dc5/classusb_c_d_c.html">usbCDC</a> ser;</div>
<div class="line">        ser.<a name="a12"></a><a class="code" href="../../d6/dc5/classusb_c_d_c.html#a49d431de50da7ccacf91ef33b04e99d2">connect</a>();</div>
<div class="line"><span class="preprocessor">    #else</span></div>
<div class="line"><span class="preprocessor"></span>        <a name="_a13"></a><a class="code" href="../../d8/d1d/class_c_serial.html">CSerial</a> ser;</div>
<div class="line">        ser.<a name="a14"></a><a class="code" href="../../d8/d1d/class_c_serial.html#a0c80ea521e310305579e787f21a55233">settings</a>(115200);</div>
<div class="line"><span class="preprocessor">    #endif</span></div>
<div class="line"><span class="preprocessor"></span>    <a name="_a15"></a><a class="code" href="../../d4/d37/class_c_debug.html">CDebug</a> dbg(ser);</div>
<div class="line">    dbg.start();</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// your setup code here</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <a class="code" href="../../d7/d03/classble_serial.html">bleSerial</a> ble(<span class="stringliteral">&quot;myProximity&quot;</span>);</div>
<div class="line">    ble.advertising(100, -67, 500); <span class="comment">// set Advertising interval=500ms, txPowerLevel=-67dBm @ 1M</span></div>
<div class="line">    ble.enable();</div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Device Information Service</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <a name="_a16"></a><a class="code" href="../../d3/dc5/classble_device_info.html">bleDeviceInfo</a> info(ble);</div>
<div class="line">    info.setManufactureName(u8<span class="stringliteral">&quot;英倍達國際&quot;</span>); <span class="comment">// u8 mean to use the UTF-8 string</span></div>
<div class="line">    info.setModelNumber(<span class="stringliteral">&quot;nano11U37&quot;</span>);</div>
<div class="line">    info.setSerialNumber(<span class="stringliteral">&quot;140226000&quot;</span>);</div>
<div class="line">    info.setFirmwareRevision(uCXpresso_VER_STR);</div>
<div class="line">    info.setHardwareRevision(<span class="stringliteral">&quot;R1&quot;</span>);</div>
<div class="line">    info.setPnP(<a name="a17"></a><a class="code" href="../../db/dff/group___enumerations.html#gga42b352f4817787f82d2adcffd4793ad9a704d8d311290a7c789e3902af79ae043">VS_USB</a>, 1, 2, 0x3456);      <span class="comment">// vendor Id=1, product Id = 2,  product ver. = 0x3456 */</span></div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Proximity Service</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    myProximity             alert(ble);</div>
<div class="line">    <a name="_a18"></a><a class="code" href="../../d8/d3b/classble_battery_level.html">bleBatteryLevel</a>         bat(ble);</div>
<div class="line">    <a name="_a19"></a><a class="code" href="../../d9/d26/classble_health_thermometer.html">bleHealthThermometer</a>    ht(ble);</div>
<div class="line">    ht.measurementInterval(1);  <span class="comment">// set measurement interval = 1 second</span></div>
<div class="line"></div>
<div class="line">    <a name="_a20"></a><a class="code" href="../../d5/d5b/class_c_timeout.html">CTimeout</a> t1, t2;</div>
<div class="line">    <span class="keywordtype">float</span>    value;</div>
<div class="line">    uint8_t  level;</div>
<div class="line"></div>
<div class="line">    <a class="code" href="../../d7/db9/class_c_pin.html">CPin</a>        key(<a name="a21"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432faed37383bf61eada38df9ffe0a367171a">P18</a>);</div>
<div class="line">    key.input();</div>
<div class="line"></div>
<div class="line">    <a class="code" href="../../db/dff/group___enumerations.html#ga6f24594071a026b31238ab8cb80d6a80">PIN_LEVEL_T</a> pinVal = key;</div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifndef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span>    myPowerSave ps;                     <span class="comment">// use power Save feature</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line">    <span class="keywordflow">while</span>(1) {</div>
<div class="line">        <span class="keywordflow">if</span> ( ble.isConnected() ) {</div>
<div class="line"><span class="preprocessor">#ifndef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span>            ps.disable();</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span>            <span class="comment">//</span></div>
<div class="line">            <span class="comment">// Battery Level</span></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="keywordflow">if</span> ( t1.<a name="a22"></a><a class="code" href="../../d5/d5b/class_c_timeout.html#a3841c7c53689d2ef8559a6c5e402aa5b">isExpired</a>(3000) ) { <span class="comment">// interval 3 seconds</span></div>
<div class="line">                t1.<a name="a23"></a><a class="code" href="../../d5/d5b/class_c_timeout.html#a663a09bb51c1de8f8d83bd62fdc1a688">reset</a>();</div>
<div class="line">                <span class="keywordflow">if</span> ( bat.readSystemVoltage(value) ) {</div>
<div class="line">                    level = map(value, 2.0, 3.3, 0, 100);   <span class="comment">// 0%~100%</span></div>
<div class="line">                    bat.sendBatteryLevel(level);</div>
<div class="line">                }</div>
<div class="line">            }</div>
<div class="line"></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="comment">// Health Thermometer Service</span></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="keywordflow">if</span> ( t2.<a class="code" href="../../d5/d5b/class_c_timeout.html#a3841c7c53689d2ef8559a6c5e402aa5b">isExpired</a>(1000) ) { <span class="comment">// interval 1 seconds</span></div>
<div class="line">                t2.<a class="code" href="../../d5/d5b/class_c_timeout.html#a663a09bb51c1de8f8d83bd62fdc1a688">reset</a>();</div>
<div class="line">                <span class="keywordflow">if</span> ( ht.readTemperature(value) ) {</div>
<div class="line">                    ht.sendMeasure(value);</div>
<div class="line">                }</div>
<div class="line">            }</div>
<div class="line"></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="comment">// Proximity Service</span></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="keywordflow">if</span> ( key != pinVal ) {</div>
<div class="line">                pinVal = key;</div>
<div class="line">                alert.sendEvent(key.read()==<a name="a24"></a><a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80a6a226f4143ca3b18999551694cdb72a8">LOW</a> ? 1 : 0);</div>
<div class="line">            }</div>
<div class="line"></div>
<div class="line">        } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="preprocessor">#ifndef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span>            ps.enable(<a name="a25"></a><a class="code" href="../../db/dff/group___enumerations.html#ggab0f874168f0e852de8b43f54553826d5a2abda45f1b1e5bbe193611fb41ae7dfa">POWER_DOWN</a>);</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span>            sleep(1000);</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">    <span class="keywordflow">return</span> 0 ;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// default memory pool</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">static</span> uint8_t mem_pool[DEFAULT_POOL_SIZE-64];  <span class="comment">// reduce pool to increase global stack</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// setup before the system startup</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> <span class="keywordtype">void</span> sys_setup(<span class="keywordtype">void</span>) {</div>
<div class="line">    pool_memadd((uint32_t)mem_pool, <span class="keyword">sizeof</span>(mem_pool));</div>
<div class="line"><span class="preprocessor">#if __USE_USB==0</span></div>
<div class="line"><span class="preprocessor"></span>    pool_memadd(USB_MEM_BASE, USB_MEM_SIZE);</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span>}</div>
<div class="line"></div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Fri Apr 11 2014 23:43:25 for uCXpresso.BLE by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
